{extend name="common@base" /}
{block name="content"}
<link href="https://cdn.bootcss.com/bootstrap-fileinput/4.4.8/css/fileinput.min.css" rel="stylesheet">
<section class="content">
  <div class="row">
    <div class="col-xs-12 col-md-6">
      <form action="" method="post" class="form">
        <div class="box box-primary">
          <div class="box-body">
            <div id="uploader">
              <input type="file" name="file" id="uploadfile" multiple class="file-loading"/>
            </div>
          </div>
          <div class="box-footer">
            <p class="label label-danger">请注意，班主任只能导入自己班级的考生</p>
          </div>
        </div>
      </form>
    </div>
  </div>
</section>
{/block}
{block name="page_script"}
<script>
  require(["layer_config", "ajaxForm",], function (layer) {

  });
  require(['bsupload_zh'], function () {
    upload_config.uploadUrl = '{:url("base/file/upload",["id"=>$id])}';
    upload_config.showCaption = true;
    upload_config.allowedFileExtensions = ['xls','xlsx'];
    $("#uploadfile").fileinput(upload_config);
    $("#uploadfile").on("fileuploaded", function (event, data, previewId, index) {
      var response = data.response;
      if (response.code == 0) {
        js_alert(response.msg);
        return false;
      }
      window.location.href = response.url + "?file_id=" + response.data.file_id;
      console.log(response.url);
    });
  });

</script>
{/block}





